home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / gui / notifications / sounds.pyo (.txt) < prev   
Python Compiled Bytecode  |  2008-10-13  |  2KB  |  51 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from __future__ import with_statement
  5. from gui import skin
  6. import syck
  7.  
  8. class SoundsetException(Exception):
  9.     pass
  10.  
  11.  
  12. class Soundset(dict):
  13.     pass
  14.  
  15. DESC_FILENAME = 'sounds.yaml'
  16. from gui.notifications import underscores_to_dots
  17.  
  18. def fix_paths(d, soundset_dir):
  19.     for k, v in d.iteritems():
  20.         d[k] = (soundset_dir / v).abspath()
  21.     
  22.  
  23. _soundset = None
  24.  
  25. def active_soundset():
  26.     global _soundset
  27.     if _soundset is not None:
  28.         return _soundset
  29.     
  30.     _soundset = load_soundset('default')
  31.     return _soundset
  32.  
  33.  
  34. def load_soundset(name):
  35.     soundsetdir = skin.resourcedir() / 'sounds' / name
  36.     soundset_yaml = soundsetdir / DESC_FILENAME
  37.     if not soundset_yaml.exists():
  38.         raise SoundsetException('soundset %r is missing %r' % (name, DESC_FILENAME))
  39.     
  40.     
  41.     try:
  42.         f = _[2]
  43.         soundset = syck.load(f)
  44.     finally:
  45.         pass
  46.  
  47.     underscores_to_dots(soundset)
  48.     fix_paths(soundset, soundsetdir)
  49.     return Soundset(soundset)
  50.  
  51.